<template>
  <a-row :gutter="10">
    <a-col :md="24" :sm="24" style="margin-bottom: 20px">
      <a-card :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <!-- 搜索区域 -->
          <div class="header_left">
            <div class="header_left_top">
              <div class="icon_box">
                <i class="iconfont icon-31shouyexuanzhong"></i>
              </div>
              <div>
                <span class="name">流程管理</span>
                <p></p>
              </div>
            </div>
            <span class="total">0个项目,已在9分钟前更新</span>
          </div>

          <div class="header_right">
            <!-- 操作按钮区域 -->
            <div class="table-operator">
              <a-button @click="handleAdd" type="primary" icon="plus"
                >新建流程</a-button
              >
            </div>
            <!-- 表单搜索 -->
            <a-form
              class="form_"
              layout="inline"
              @keyup.enter.native="searchQuery"
            >
              <a-form-item>
                <a-input
                  placeholder="流程名称"
                  v-model="queryParam.phone"
                ></a-input>
              </a-form-item>
              <a-form-item>
                <a-input
                  placeholder="流程类型"
                  v-model="queryParam.phone"
                ></a-input>
              </a-form-item>
              <span
                style="float: left; overflow: hidden"
                class="table-page-search-submitButtons"
              >
                <a-button type="primary" @click="searchQuery" icon="search"
                  >查询</a-button
                >
                <a-button type="primary" @click="searchReset" icon="reload"
                  >重置</a-button
                >
              </span>
            </a-form>
          </div>
        </div>
        <!-- 操作按钮区域 -->

        <div style="margin-top: 15px">
          <a-table
            style="height: 500px"
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            @change="handleTableChange"
          >
            <span slot="action" slot-scope="text, record">
              <a @click="handleEdit2(record)">流程设计</a>
              <a-divider type="vertical" />
              <a @click="handleEdit2(record)">配置</a>
              <a-divider type="vertical" />
              <a @click="handleEdit2(record)">发布</a>
              <a-divider type="vertical" />
              <a-dropdown>
                <a class="ant-dropdown-link"> 更多 <a-icon type="down" /> </a>
                <a-menu slot="overlay">
                  <a-menu-item>
                    <a @click="handlePerssion(record.id)">授权</a>
                  </a-menu-item>
                  <a-menu-item>
                    <a @click="handleEdit(record)">编辑</a>
                  </a-menu-item>
                  <a-menu-item>
                    <a-popconfirm
                      title="确定删除吗?"
                      @confirm="() => handleDelete1(record.id)"
                    >
                      <a>删除</a>
                    </a-popconfirm>
                  </a-menu-item>
                </a-menu>
              </a-dropdown>
            </span>
          </a-table>
        </div>
        <!-- 右侧的角色权限配置 -->
        <ProcessIndex ref="ProcessModal"></ProcessIndex>
        <user-role-modal ref="modalUserRole"></user-role-modal>
        <role-modal ref="modalForm" @ok="modalFormOk"></role-modal>
      </a-card>
    </a-col>
  </a-row>
</template>
<script>
import { ListMixin } from "@/mixins/ListMixin";
import SelectUserModal from "./User/SelectUserModal";
import RoleModal from "./Role/addRoleModal.vue";
import UserModal from "./User/UserModal";
import { filterObj } from "@/utils/util";
import UserRoleModal from "./Role/UserRoleModal";

import ProcessIndex from "./Process/ProcessIndex.vue";
//   import moment from 'moment'

export default {
  name: "ProcessPage",
  mixins: [ListMixin],
  components: {
    UserRoleModal,
    SelectUserModal,
    RoleModal,
    UserModal,
    ProcessIndex,
  },

  data() {
    return {
      model1: {},
      loading1: false,
      columns: [
        {
          title: "流程名称",
          align: "left",
          dataIndex: "processName",
        },
        {
          title: "流程编码",
          align: "left",
          dataIndex: "processKey",
        },
        {
          title: "流程类型",
          align: "left",
          dataIndex: "processType",
        },
        {
          title: "发布状态",
          align: "left",
          dataIndex: "openStatus",
        },
        {
          title: "创建时间",
          align: "left",
          dataIndex: "createTime",
        },
        {
          title: "操作",
          dataIndex: "action",
          align: "left",
          scopedSlots: { customRender: "action" },
        },
      ],
    };
  },
  mounted() {
    this.loadData();
  },

  methods: {
    handleAdd() {
      this.$refs.ProcessModal.visible = true;
    },
    loadData() {
      this.$axios.get("api/process").then((res) => {
        // //   console.log(res);
        this.dataSource = res.data;
      });
    },
  },
};
</script>
<style scoped lang="scss">
// @import "@/assets/css/listcommon.scss";
/* @import '~@assets/less/common.less'; */
/** Button按钮间距 */
.ant-btn {
  margin-left: 8px;
}
</style>